package cn.lyh.gulimall.member.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.lyh.gulimall.member.dao.UmsMemberLevelMapper;
import cn.lyh.gulimall.member.entity.UmsMemberLevel;
import utils.PageUtils;

/**
 * @author lyh
 * @version 1.0
 * @since 2021/4/6
 */
@Service
public class UmsMemberLevelService extends ServiceImpl<UmsMemberLevelMapper, UmsMemberLevel> {

	@Autowired
	UmsMemberLevelMapper memberLevelMapper;

	public PageUtils getLeveListByPage(Map<String, Object> params) {
		System.out.println(params);
		// 获取key
		// 获取分页数据
		long curPage = params.get("page") != null ? Long.parseLong((String) params.get("page")) : 1;
		long limit = params.get("limit") != null ? Long.parseLong((String) params.get("limit")) : 10;
		Page<UmsMemberLevel> memberLevelPage = new Page<>(curPage,limit);
		Page<UmsMemberLevel> selectPage = memberLevelMapper.selectPage(memberLevelPage, new QueryWrapper<>(null));
		PageUtils pageUtils = new PageUtils(selectPage);
		return pageUtils;


	}
}
